<template>
    <div class="addArehousing">
        <van-nav-bar title="新增入库" left-arrow @click-left="handleLeft">
        </van-nav-bar>
        <router-view />
        <div class="flexd">
            <div @click="selectOne('add')" class="addArehousing_item" v-if="indexs != '1'">
                <div class="imgs"><van-image :src="add"></van-image></div>
                <div class="title">选择库存单</div>
            </div>
            <div @click="selectOneProduct()" class="addArehousing_item" v-if="indexs == '1'">
                <div class="imgs"><van-image :src="add"></van-image></div>
                <div class="title">选择商品</div>
            </div>
            <div @click="scanCode" class="addArehousing_item addArehousing_code">
                <div class="imgs"><van-image :src="saoma"></van-image></div>
                <div class="title">扫码入库</div>
            </div>
        </div>
        <div class="titles">商品明细</div>
        <div class="conent">
            <div v-for="(item, index) in warehouseList" :key="index" class="conent_pre">
                <div class="conent_pre_header">
                    <div class="conent_pre_img">
                        <van-image :src="item.productImage + '?x-oss-process=image/resize,w_300'"
                            v-if="item.productImage" @click="enlargeImage(item.productImage)"></van-image>
                        <van-image :src="errImg" v-else></van-image>
                    </div>
                    <div class="conent_pre_des">
                        <div class="contnt_title">
                            <div class="contnt_styleName">
                                {{ indexs == '2' ? item.productName : item.styleName }}
                            </div>
                            <div :class="'contnt_status' + item.shelvesStatus">
                                {{ shelvesStatusNameByIdss(item.shelvesStatus) }}
                            </div>
                        </div>
                        <div class="contnt_mechanism">
                            {{ item.sellingPoints }}
                        </div>
                        <div class="contnt_bottom">
                            <div class="price">￥ {{ indexs == '2' ? (item.mechanism?.price || item.mechanism?.costPrice)
                                : (item.mechanismList[0]?.price || item.mechanismList[0]?.costPrice) }}</div>
                            <div class="commission" v-if="indexs == '2' && item.mechanism?.commission">
                                {{ (item.mechanism?.commission || 0) + "%" }}
                            </div>
                            <div class="commission" v-if="indexs != '2' && item.mechanismList?.commission">
                                {{ (item.mechanismList?.commission || 0) + "%" }}
                            </div>
                            <div class="coreName" v-if="item.ssociatedInventory !== '请选择'">{{ item.coreName }}</div>
                        </div>
                    </div>
                </div>
                <div class="product_detail_title--content">
                    <div class="product_detail_title-content-info">
                        <div class="product_detail_title-content-info-name">机制：</div>
                        <div class="product_detail_title-content-info-content">
                            {{ indexs == '2' ? item.mechanism?.liveStreamingMechanism :
                                item.mechanismList[0]?.liveStreamingMechanism }}
                        </div>
                    </div>
                    <div class="product_detail_title-content-info">
                        <div class="product_detail_title-content-info-name">规格/材质：</div>
                        <div class="product_detail_title-content-info-content">
                            {{ item.specs }}
                        </div>
                    </div>
                    <div class="product_detail_title-content-info">
                        <div class="product_detail_title-content-info-name">入库数量：</div>
                        <div class="product_detail_title-content-info-content">
                            <van-stepper v-model="totalList[index]" :min="0" :max="indexs == '1' ? 999 : item.quantity"
                                integer :before-change="onChange" />
                        </div>
                    </div>
                    <div class="product_detail_title-content-info" v-if="indexs !== '1'">
                        <div class="product_detail_title-content-info-name"><span style="color: red;">*</span>关联库存单：
                        </div>
                        <div class="product_detail_title-content-info-content" @click="selectOne('edit', index, item)">
                            {{ item.ssociatedInventory }}<van-icon name="arrow" />
                        </div>
                    </div>
                    <div class="product_detail_title-content-info">
                        <div class="product_detail_title-content-info-left">
                            <div class="left_title">
                                当前库存：
                                <span style="color: #0094FF;">{{ indexs == '2' ? item.stock ||
                                    0 : item.stockInfo.stockAvailable || 0 }}件</span>
                            </div>
                            <img v-if="item.noPutStatus == 1" class="left_img" :src="icon_tanhao" alt=""
                                @click="() => { nonReturnRef.init({ ...item, coreUserName: item.coreName, totalOutNum: item.quantity, putNum: item.returnNum }) }">
                        </div>
                        <div class="buttons" @click="removeClick(item)">移除</div>
                    </div>
                </div>
            </div>
        </div>
        <van-overlay :show="overlayShow">
            <van-loading color="#1989fa">加载中...</van-loading>
        </van-overlay>
        <van-dialog v-model:show="dialogShow" title="提示" :showConfirmButton="false">
            <div class="dialog_title">是否对所选商品进行入库？</div>
            <div class="dialog_buttons">
                <div @click="cancel" class="cancel">取消</div>
                <van-button @click="warehousingClick" class="save" v-throttle:click :loading="buttonLoading"
                    loading-text="执行中...">确认</van-button>
            </div>
        </van-dialog>
        <div class="conputed_bottom" v-show="buttonsShow">
            <div class="retained">
                <div class="label">拍照留存</div>
                <div class="value">
                    <div v-for="(item, index) in evidenceList" :key="index" class="imgList">
                        <div class="loading_pic" v-if="!item.url">
                            <van-loading type="spinner" size="20" />
                        </div>
                        <van-image v-if="item.url" :src="item.url ? item.url + '?x-oss-process=image/resize,w_300' : ''"
                            @click="enlargeImage(item.url)"></van-image>
                        <van-icon v-if="item.url" name="cross" color="#fff"
                            @click.prevent="deleteImg(evidenceList, index)" />
                    </div>
                    <van-image :src="upload" v-if="evidenceList.length < 5" @click="postImage('evidence', 5)"
                        v-throttle:click></van-image>
                </div>
            </div>
            <div class="conputed_bottom_total">
                <div class="conputed_bottom_left">
                    <van-image :src="ruku"></van-image>
                    共<span class="span">{{ total }}</span>件商品入库
                </div>
                <div class="button" @click="warehousingSave">入库</div>
            </div>
        </div>
        <NonReturn ref="nonReturnRef" />
    </div>
</template>
<script setup lang="ts">
import { loginStore } from "@/store/login";
import { storeToRefs } from "pinia";
import { getSupplierAddProductsById } from "@/api/productList/index";
import { showConfirmDialog, showFailToast, showImagePreview, showSuccessToast } from "vant";
import { computed, onMounted, ref, watch, onUnmounted } from "vue";
import { useRoute, useRouter } from "vue-router";
import { shelvesStatusNameByIdss } from '@/utils/statusNameById'
import { supplementInStock, scanGetOutProduct, coreReturnInStock } from '@/api/productHome/index'
import { getEnvValue } from "@/utils/index";
import { isPositiveInteger } from '@/utils/validate'
import NonReturn from '@/components/nonReturn/index.vue'
import { handleImageUpdate } from "@/utils/handleImageUpdate";
const router = useRouter();
const route = useRoute();
const errImg = new URL("@/assets/home/error.png", import.meta.url).href;
const saoma = new URL("@/assets/productHome/icon_saoyisao1.png", import.meta.url).href;
const add = new URL("@/assets/productHome/icon_tianjia.png", import.meta.url).href;
const ruku = new URL("@/assets/productHome/icon_ruku.png", import.meta.url).href;
const upload = new URL("@/assets/home/upload.png", import.meta.url).href;
const icon_tanhao = new URL("@/assets/operation/icon_tanhao.png", import.meta.url).href;

const buttonLoading = ref(false)
const nonReturnRef = ref()
const warehouseList = ref<any>([])
const totalList = ref<any>([])
const overlayShow = ref(false)
const loading = ref(false)
// 留存
const evidenceList = ref<any[]>([]);

// 二次确认弹窗
const dialogShow = ref(false)
const buttonsShow = ref(true)
const defaultPhoneHeight = ref(0) //屏幕默认高度
const nowPhoneHeight = ref(0) //屏幕现在的高度
// 在组件挂载完成后添加事件监听器
onMounted(() => {
    defaultPhoneHeight.value = window.innerHeight;
    // 添加事件监听器
    window.addEventListener('resize', handleResize);
})
// 处理窗口大小变化的函数
const handleResize = () => {
    nowPhoneHeight.value = window.innerHeight;
};
// 在组件卸载前移除事件监听器
onUnmounted(() => {
    window.removeEventListener('resize', handleResize);
});
watch(nowPhoneHeight, () => {
    if (defaultPhoneHeight.value != nowPhoneHeight.value) {
        // 当软键盘弹出,改变bottomIsSHow变量然后去控制bottom的显示与隐藏
        buttonsShow.value = false
    } else {
        // 相等代表软键盘收起后,与上同理
        buttonsShow.value = true
    }
})

// 入口 补样入库 == 1 还品入库 == 2
const indexs = computed(() => {
    return route.query.index;
});

// 关联库存单 数据留存
const info = computed(() => {
    return route.query.info;
})

// 商品修改的管理库存单 或者 新增商品的关联库存单
const types = computed(() => {
    return route.query.types;
})

// 补样入库没有库存单 

const total = computed(() => {
    return totalList.value.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
});

watch(
    () => info.value,
    (v: any) => {
        totalList.value = JSON.parse(localStorage.getItem('totalList') as any) || []
        // 拍照留存
        evidenceList.value = JSON.parse(localStorage.getItem('evidenceList') as any) || []
        // 还品关联库存单入库
        if (v && types.value == 'add') {
            if (localStorage.getItem('warehouseList')) {
                warehouseList.value = JSON.parse(localStorage.getItem('warehouseList') as any)
                const date = JSON.parse(v)
                date.forEach((item: any) => {
                    item.ssociatedInventory = item.orderId
                    if (item.productImage !== '') {
                        item.productImage = getEnvValue("VITE_APP_PIC_URL") + item.productImage.split(',')[0]
                    }
                    warehouseList.value.push(item)
                })
            }
            // 还品扫码入库关联库存单        // 有库存单时 更改库存单
        } else if (v && (types.value == 'edit' || types.value == 'editOriginal')) {
            if (localStorage.getItem('warehouseList') && localStorage.getItem('warehouseIndex')) {
                const ind = Number(localStorage.getItem('warehouseIndex'))
                warehouseList.value = JSON.parse(localStorage.getItem('warehouseList') as any)
                const a = JSON.parse(v)
                // 库存单id
                warehouseList.value[ind].ssociatedInventory = a[0].orderId
                // 关联库存单出库数量
                warehouseList.value[ind].quantity = a[0].quantity
                // 关联库存单detailId
                warehouseList.value[ind].detailId = a[0].detailId
            }

        } else if (v && types.value === 'addProduct') { // 选择商品入库
            if (localStorage.getItem('warehouseList')) {
                warehouseList.value = JSON.parse(localStorage.getItem('warehouseList') as any)
                const data = JSON.parse(v)
                if (warehouseList.value && warehouseList.value.length) {
                    data.forEach((it) => {
                        const matchingItemIndex = warehouseList.value.findIndex((item) => item.id === it.id);

                        if (matchingItemIndex !== -1) {
                            // 如果找到了匹配的 item，则更新 totalList 中对应索引的值
                            if (totalList.value[matchingItemIndex] < 999) {
                                totalList.value[matchingItemIndex] = Number(totalList.value[matchingItemIndex]) + 1
                            }
                        } else {
                            // 如果没有找到匹配的 item，则将 it 添加到 warehouseList 和 totalList
                            warehouseList.value.push(it);
                        }
                    });
                } else {
                    warehouseList.value.push(...data)
                }
            } else {
                const date = JSON.parse(v)
                warehouseList.value.push(...date)
            }
        } else {
            if (localStorage.getItem('warehouseList')) {
                warehouseList.value = JSON.parse(localStorage.getItem('warehouseList') as any)
            }
        }
    },
    { immediate: true }
);

/** 图片放大 */
const enlargeImage = (img: string) => {
    if (img) {
        showImagePreview({
            images: [img],
        });
    }
};
/** 选择商品 */
const selectOneProduct = () => {
    localStorage.setItem("warehouseList", JSON.stringify(warehouseList.value));
    localStorage.setItem("totalList", JSON.stringify(totalList.value));
    localStorage.setItem("evidenceList", JSON.stringify(evidenceList.value));
    router.push({
        path: '/inboundGoods',
        query: {
            index: indexs.value,
        }
    })
}
/** 入库二次确认 */
const warehousingSave = () => {
    dialogShow.value = true
}
/** 入库二次取消 */
const cancel = () => {
    dialogShow.value = false
}
/** 选择库存单 */
const selectOne = (type: string, index?: number, item?: any) => {
    localStorage.setItem("warehouseList", JSON.stringify(warehouseList.value));
    localStorage.setItem("totalList", JSON.stringify(totalList.value));
    localStorage.setItem("evidenceList", JSON.stringify(evidenceList.value));
    if (index !== undefined) {
        localStorage.setItem("warehouseIndex", index + '');
    }
    let types: string | undefined;
    let ssociatedInventoryId: string | undefined;
    if (item) {
        // 没有库存单时
        if (item.ssociatedInventory == '请选择') {
            types = type
        } else {
            types = 'editOriginal' // 有库存单时 更改库存单

        }
        ssociatedInventoryId = item.detailId
    } else {
        types = type
    }
    router.push({
        path: '/associatedInventory',
        query: {
            index: indexs.value,
            type: types,
            ssociatedInventoryId: ssociatedInventoryId,
            productId: type !== 'add' ? item.productId : ''
        }
    })

}
/** 回退 */
const handleLeft = () => {
    if (warehouseList.value.length) {
        showConfirmDialog({
            message:
                '退出后将不保留未完成操作',
        })
            .then(() => {
                router.push('/storageType')
                // 清除缓存
                localStorage.removeItem('warehouseList')
                localStorage.removeItem('warehouseIndex')
                localStorage.removeItem('relatedDocumentsId')
                localStorage.removeItem('totalList')
                localStorage.removeItem('evidenceList')
                localStorage.removeItem('storesId')
            })
            .catch(() => {
                // on cancel
            });
    } else {
        router.push('/storageType')
        // 清除缓存
        localStorage.removeItem('warehouseList')
        localStorage.removeItem('warehouseIndex')
        localStorage.removeItem('relatedDocumentsId')
        localStorage.removeItem('totalList')
        localStorage.removeItem('evidenceList')
        localStorage.removeItem('storesId')
    }

}

/** 移除当前数据 */
const removeClick = (item: any) => {
    const removeIndex = warehouseList.value.indexOf(item)
    // 删除其中数据
    warehouseList.value.splice(removeIndex, 1)
    // 删除入库总数
    totalList.value.splice(removeIndex, 1)


    // 主播还品入库的关联库存单  ==> 删除
    if (indexs.value == '2') {
        // 这条数据存在库存单
        if (item.ssociatedInventory !== '请选择') {
            const arrList = JSON.parse(localStorage.getItem('relatedDocumentsId') as any)
            const arrIndex = arrList.indexOf(item.detailId)
            arrList.splice(arrIndex, 1)
            localStorage.setItem('relatedDocumentsId', JSON.stringify(arrList))
        }
    }

    // 选择商品删除缓存
    if (localStorage.getItem('storesId')) {
        const arrList = JSON.parse(localStorage.getItem('storesId') as any)
        arrList.splice(removeIndex, 1)
        localStorage.setItem('storesId', JSON.stringify(arrList))
    }

}

// 步进器限制 阻止输入负数
const onChange = (value: string): any => {
    return new Promise((resolve) => {
        if (value !== '-') {
            resolve(true);
        }
    });
}
/**
 * 图片全路径转半路径
 * @param list 
 */
const getPicByfullPath = (list: any[]) => {
    if (list.length > 0) {
        const updatedList = list.map((item: any) => {
            return item.url.split(getEnvValue("VITE_APP_PIC_URL"))[1];
        });
        return updatedList.join(',');
    } else {
        return '';
    }
}
/** 入库 */
const warehousingClick = async () => {
    if (warehouseList.value.length == 0) {
        showFailToast('请选择入库商品');
    } else {
        // 还品入库
        if (indexs.value == '2') {
            const hasEmptyValue = warehouseList.value.filter(item => item.ssociatedInventory == '请选择')
            if (hasEmptyValue.length == 0) {
                const lists = warehouseList.value.map((item: any, index: number) => {
                    return {
                        productId: item.productId,
                        quantity: totalList.value[index],
                        relevancyOrderId: item.orderId || item.ssociatedInventory,
                        relevancyDetailId: item.detailId,
                        // 关联单得出库数量
                        relevancyDetailQuantity: item.quantity,
                    }
                })
                dialogShow.value = false
                loading.value = true
                buttonLoading.value = true
                try {
                    // 主播还品入库
                    await coreReturnInStock({
                        details: lists,
                        // 拍照留存
                        evidence: getPicByfullPath(evidenceList.value)
                    })
                    buttonLoading.value = false
                    loading.value = false
                    showSuccessToast('主播还品入库成功')
                    // 清除缓存
                    localStorage.removeItem('warehouseList')
                    localStorage.removeItem('warehouseIndex')
                    localStorage.removeItem('relatedDocumentsId')
                    localStorage.removeItem('totalList')
                    localStorage.removeItem('evidenceList')
                    localStorage.removeItem('storesId')
                    router.push({
                        path: '/addArehousingSuccess',
                        query: {
                            from: 'addArehousing',
                            index: indexs.value
                        }
                    })
                } catch {
                    buttonLoading.value = false
                    loading.value = false
                }


            } else {
                showFailToast('请选择完善商品的关联库存单');
            }
        } else {
            const lists = warehouseList.value.map((item: any, index: number) => {
                return {
                    productId: item.id,
                    quantity: totalList.value[index],
                }
            })
            buttonLoading.value = true
            try {
                // 补样入库
                await supplementInStock({
                    details: lists,
                    // 拍照留存
                    evidence: getPicByfullPath(evidenceList.value)
                })
                showSuccessToast('补样入库成功')
                buttonLoading.value = false
                loading.value = false
                // // 清除缓存
                localStorage.removeItem('warehouseList')
                localStorage.removeItem('warehouseIndex')
                localStorage.removeItem('relatedDocumentsId')
                localStorage.removeItem('totalList')
                localStorage.removeItem('evidenceList')
                localStorage.removeItem('storesId')
                router.push({
                    path: '/addArehousingSuccess',
                    query: {
                        from: 'addArehousing',
                        index: indexs.value
                    }
                })
            } catch {
                buttonLoading.value = false
                loading.value = false
            }
        }
    }
}
/** 扫码入库 */
const scanCode = async () => {
    (window as any).uni.webView.postMessage({
        data: {
            type: "scanCode",
            name: "warehouse"
        },
    });

}
/** uniapp端回传扫码数据 */
(window as any).msgFromUniapp = async (arg) => {
    // 货架
    if (arg.name == 'warehouse') {
        overlayShow.value = true
        try {
            if (isPositiveInteger(arg.productId)) {
                var res: any;
                // 还品入库时 接口
                if (indexs.value == '2') {
                    res = await scanGetOutProduct({ productId: arg.productId });
                } else {
                    res = await getSupplierAddProductsById({ productId: arg.productId });
                }
                res.data.ssociatedInventory = '请选择'
                res.data.productImage = getEnvValue("VITE_APP_PIC_URL") + res.data.productImage.split(',')[0]

                // 还品入库
                if (indexs.value == '2') {
                    // 有orderId时 只有一条库存单
                    if (res.data.orderId) {
                        // 关联库存单
                        res.data.ssociatedInventory = res.data.orderId
                    }

                    // 补样入库 主播还品入库的商品 ==> 相同产品入库只增加数量 
                    // 获取存储中是否有扫码的的当条数据
                    if (localStorage.getItem('relatedDocumentsId') && JSON.parse(localStorage.getItem('relatedDocumentsId') as any).length > 0) {
                        const arrList = JSON.parse(localStorage.getItem('relatedDocumentsId') as any)
                        if (arrList.indexOf(res.data.detailId) !== -1) {
                            const ind = arrList.indexOf(res.data.detailId)
                            if (totalList.value[ind] < res.data.quantity) {
                                totalList.value[ind] = Number(totalList.value[ind]) + 1
                                localStorage.setItem("totalList", JSON.stringify(totalList.value));
                            }
                        } else {
                            warehouseList.value.push(res.data)
                            localStorage.setItem("warehouseList", JSON.stringify(warehouseList.value));
                            if (res.data.ssociatedInventory != '请选择') {
                                arrList.push(res.data.detailId)
                                localStorage.setItem('relatedDocumentsId', JSON.stringify(arrList))
                            }
                        }
                    } else {
                        warehouseList.value.push(res.data)
                        if (res.data.ssociatedInventory != '请选择') {
                            localStorage.setItem("warehouseList", JSON.stringify(warehouseList.value));
                            const idList = warehouseList.value.map(item => item.detailId)
                            localStorage.setItem('relatedDocumentsId', JSON.stringify(idList))
                        } else {

                        }
                    }
                    overlayShow.value = false
                } else if (indexs.value == '1') {
                    const showIndex = warehouseList.value.findIndex(item => item.id == res.data.id)
                    if (showIndex !== -1) {
                        if (totalList.value[showIndex] < 999) {
                            totalList.value[showIndex] = Number(totalList.value[showIndex]) + 1
                        }
                    } else {
                        warehouseList.value.push(res.data)
                    }
                    overlayShow.value = false
                }
            } else {
                showFailToast({ message: '该商品不存在' });
                overlayShow.value = false
            }

        } catch (error) {
            overlayShow.value = false
        }
    }
    // 拍照留存
    if (arg.name == 'evidence') {
        const imageLists = {
            evidence: evidenceList.value,
        };

        const maxCounts = {
            evidence: 5,
        };

        const imageList = imageLists[arg.name];
        const maxCount = maxCounts[arg.name];

        handleImageUpdate(imageList, arg, maxCount);

    }
}
/** 删除 */
const deleteImg = (list: any, index: number) => {
    list.splice(index, 1);
};
const store = loginStore();
const { token } = storeToRefs(store);
/** 上传图片 */
const postImage = (name: string, count: number) => {
    (window as any).uni.webView.postMessage({
        data: {
            type: "img",
            count: count,
            name: name,
            url: getEnvValue("VITE_APP_UPLOAD_API") + "/resource/oss/upload",
            header: {
                Authorization: `Bearer ${token.value}`,
                clientid: "e5cd7e4891bf95d1d19206ce24a7b32e",
            },
        },
    });
};
</script>

<style lang="less" scoped>
.addArehousing {
    height: calc(100vh - 44px);
    width: 100%;
    background: #F6FAFF;
    // padding-top: 15px;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-flow: column;

    :deep(.van-overlay) {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    :deep(.van-dialog__content) {
        box-sizing: border-box;
        padding: 20px;
    }

    .dialog_title {
        text-align: center;
        margin: 20px;
    }

    .dialog_buttons {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;

        .cancel {
            width: 135px;
            height: 44px;
            border-radius: 23px;
            border: 1px solid #1A1B1C;
            text-align: center;
            line-height: 44px;
        }

        .save {
            width: 135px;
            height: 44px;
            background: #0094FF;
            border-radius: 23px;
            text-align: center;
            line-height: 44px;
            font-weight: 400;
            font-size: 14px;
            color: #FFFFFF;
        }
    }

    .addArehousing_code {
        margin-top: 15px !important;
    }

    .addArehousing_item {
        width: 151px;
        height: 42px;
        background: #FFFFFF;
        border-radius: 21px;
        font-weight: 400;
        font-size: 16px;
        color: #0094FF;
        display: flex;
        justify-content: center;
        align-items: center;
        margin: auto;
        margin-top: 15px;

        .imgs {
            width: 25%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: right;
        }

        .title {
            width: 70%;
            display: flex;
            align-items: center;
            padding-left: 10px;
            box-sizing: border-box;
        }

        .van-image {
            width: 16px;
            height: 16px;
        }
    }

    .flexd {
        display: flex;
        align-items: center;
    }

    .titles {
        font-weight: 500;
        font-size: 16px;
        color: #1A1B1C;
        margin: 15px 0 10px 15px;
    }

    .conent_pre {
        width: 100%;
        padding: 15px;
        box-sizing: border-box;
        background-color: #fff;
        margin-top: 10px;

        .conent_pre_header {
            width: 100%;
            display: flex;
            justify-content: space-between;
            align-items: center;

            .conent_pre_img {
                width: 90px;
                height: 90px;

                .van-image {
                    width: 90px;
                    height: 90px;

                    :deep(.van-image__img) {
                        border-radius: 5px !important;
                    }
                }
            }

            .conent_pre_des {
                width: calc(100% - 90px);
                height: 90px;
                display: flex;
                justify-content: space-between;
                align-items: center;
                flex-wrap: wrap;
                padding-left: 10px;
                align-content: space-around;

                .contnt_title {
                    width: 100%;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;

                    .contnt_styleName {
                        font-weight: 400;
                        font-size: 14px;
                        color: #1A1B1C;
                        width: 150px;
                        height: 20px;
                        white-space: nowrap;
                        /* 确保文本在一行内显示 */
                        overflow: hidden;
                        /* 隐藏溢出的内容 */
                        text-overflow: ellipsis;
                    }

                    .contnt_status {
                        width: 67px;
                        height: 26px;
                        background: #EBF4FF;
                        border-radius: 2px;
                        font-weight: 400;
                        font-size: 14px;
                        color: #0094FF;
                        text-align: center;
                        line-height: 26px;
                    }

                    .contnt_status1 {
                        width: 67px;
                        height: 26px;
                        background: #EBF4FF;
                        border-radius: 2px;
                        font-weight: 400;
                        font-size: 14px;
                        color: #0094FF;
                        text-align: center;
                        line-height: 26px;
                    }

                    .contnt_status2 {
                        width: 67px;
                        height: 26px;
                        background: #E7FDEE;
                        border-radius: 2px;
                        font-weight: 400;
                        font-size: 14px;
                        color: #19D11B;
                        text-align: center;
                        line-height: 26px;
                    }

                    .contnt_status3 {
                        width: 67px;
                        height: 26px;
                        background: #FDE7E7;
                        border-radius: 2px;
                        font-weight: 400;
                        font-size: 14px;
                        color: #FC2540;
                        text-align: center;
                        line-height: 26px;
                    }

                    .contnt_status4 {
                        width: 67px;
                        height: 26px;
                        background: #EBF4FF;
                        border-radius: 2px;
                        font-weight: 400;
                        font-size: 14px;
                        color: #0094FF;
                        text-align: center;
                        line-height: 26px;
                    }

                }

                .contnt_mechanism {
                    width: 100%;
                    font-weight: 400;
                    font-size: 12px;
                    color: #B8BECA;
                    white-space: nowrap;
                    /* 确保文本在一行内显示 */
                    overflow: hidden;
                    /* 隐藏溢出的内容 */
                    text-overflow: ellipsis;
                }

                .contnt_bottom {
                    width: 100%;
                    height: 20px;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;

                    .price {
                        font-weight: 500;
                        font-size: 14px;
                        color: #FC2540;
                    }

                    .commission {
                        font-weight: 500;
                        font-size: 14px;
                        color: #FC2540;
                    }

                    .coreName {
                        font-weight: 400;
                        font-size: 12px;
                        color: #0094FF;
                    }
                }
            }
        }

        .product_detail_title-content-info {
            margin-top: 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;

            .product_detail_title-content-info-name {
                font-weight: 400;
                font-size: 14px;
                color: #1a1b1c;
                line-height: 14px;
                width: 100px;
            }

            .product_detail_title-content-info-left {
                flex: 1;
                min-width: 0;
                display: flex;
                align-items: center;
                font-weight: 400;
                font-size: 14px;
                color: #1a1b1c;

                .left_img {
                    width: 14px;
                    height: 14px;
                    margin-left: 15px;
                }
            }

            .colors {
                color: #0094FF !important;
            }

            .product_detail_title-content-info-content {
                flex: 1;
                min-width: 0;
                font-weight: 400;
                font-size: 14px;
                color: #b8beca;
                line-height: 14px;
                margin-left: auto;
                display: flex;
                justify-content: flex-end;
                word-break: break-all;
            }

            .contents {
                width: 200px;
                font-weight: 400;
                font-size: 14px;
            }

            .buttons {
                width: 67px;
                height: 26px;
                background: #fff;
                border-radius: 2px;
                font-weight: 400;
                font-size: 14px;
                color: #FC2540;
                text-align: center;
                line-height: 26px;
                border: 1px solid #FC2540;
            }
        }

    }

    .conent {
        flex: 1;
        min-height: 0;
        width: 100%;
        overflow: auto;
        box-sizing: border-box;
    }

    .conputed_bottom {
        width: 100%;
        background: #FFFFFF;
        box-shadow: 0px -3px 4px 0px rgba(212, 217, 223, 0.3);
        box-sizing: border-box;
        padding: 0 15px;


        .retained {
            width: 100%;
            border-bottom: 1px solid #ececec;
            display: flex;
            flex-flow: column;
            box-sizing: border-box;
            padding: 10px 0 5px;

            .label {
                width: 100%;
                font-weight: 400;
                font-size: 14px;
                color: #1a1b1c;
                margin-bottom: 10px;
            }

            .value {
                width: 100%;
                display: flex;
                flex-wrap: wrap;

                .imgList {
                    position: relative;
                    margin-right: 5px;

                    .loading_pic {
                        width: 90px;
                        height: 90px;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                    }

                    :deep(.van-icon) {
                        position: absolute;
                        top: 0;
                        z-index: 100;
                        right: 0;
                        font-size: 10px;
                        height: 15px;
                        width: 15px;
                        background-color: #000;
                        border-bottom-left-radius: 16px;
                        display: flex;
                        justify-content: center;
                        align-items: center;
                    }

                    :deep(.van-icon-cross:before) {
                        margin: 0 0 1px 2px;
                    }
                }

                :deep(.van-image__img) {
                    width: 60px;
                    height: 60px;
                }
            }
        }

        .conputed_bottom_total {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            height: 70px;
        }

        .conputed_bottom_left {
            display: flex;
            align-items: center;

            .van-image {
                width: 40px;
                height: 40px;
                font-weight: 400;
                font-size: 14px;
                color: #1A1B1C;
                margin-right: 10px;

            }

            .span {
                font-weight: 500;
                font-size: 21px;
                color: #0094FF;
            }
        }

        .button {
            width: 120px;
            height: 40px;
            background: #0094FF;
            border-radius: 23px;
            text-align: center;
            line-height: 40px;
            font-weight: 400;
            font-size: 14px;
            color: #FFFFFF;
        }
    }
}
</style>